<template>
  <div id="b_page" style="position:relative;">
  <com-header v-on:show-what="geet"></com-header>
  <div id="recommend">
      <com-recommend></com-recommend>
  </div>
	<div  id="page">
		<ul>
          <li v-for="item in showList" @click="turnAction(item.id)">
             <div class="title">{{item.title}}</div>
              <div class="info"><label>作者:{{item.author}}</label><label>时间:{{item.createTime |filterTime }}</label><label>阅读:100</label></div>
              <div class="note">{{item.note}}</div>
          </li>      
        </ul>
        
  </div>
      
	</div>
</template>
<script >	
 import Header from '@/components/header'
  import Recommend from '@/pages/recommend'
export default {
        data: function() {
            return {
                showList:[],
                allList:[]
            }
        },
        computed:{
           
        },
        methods:{
          geet:function (msg) {
            switch(msg)
                {
                case "00":
                  this.showList=this.allList;
                  break;
                default:
                   this.showList=[];
                  for (var i = 0; i < this.allList.length; i++) {
                    if (this.allList[i].type==msg) {
                      this.showList.push(this.allList[i])
                    }else{
                      
                    }
                  }
                  return;
                }
         },
          turnAction:function(id){
           this.router.push("/details/"+id);
          },
           getArcitleList:function(){
            var _self=this;
             this.$store.commit('changeLoading', {
                isShow:true,
                title:"加载中。。。"
            })
             this.api.getActicle().then(res => {   
               _self.$store.commit('changeLoading', {
                isShow:false,
               })
                _self.allList=res.data.data;
                _self.showList=res.data.data;
           
            }).catch(function(error) {
                console.log(error);
            });
           }
           
           
        },
        components:{
            comRecommend:Recommend,
            comHeader:Header
        },
       
        created() {
           
            this.getArcitleList();
           
        },
         mounted: function() {
            

        },

       

    }

</script>
<style lang="scss" scoped>
    @import "../../static/css/index.scss";
</style>